package com.demo.limit.impl;

import com.demo.api.user.domain.TestLimit;
import com.demo.api.user.service.LimitService;
import com.demo.common.enums.ResultCode;
import com.demo.common.response.Result;
import com.demo.limit.mapper.TestLimitDao;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author
 * @since
 */
@Service(version = "1.0.0", interfaceClass = LimitService.class, timeout = 120000, retries = 2)
@Slf4j
@Component
public class LimitServiceImpl implements LimitService {

  @Autowired
  TestLimitDao testLimitDao;

  @Override
  @Transactional(rollbackFor = Exception.class)
  public Result addLimit(TestLimit testLimit) {
    log.info("新增Test_Limit, {}", testLimit);
    try {
      testLimitDao.insert(testLimit);
      log.info("新增Test_Limit结束");
      return Result.suc(true);
    } catch (Exception e){
      log.error("{}", e);
      return Result.fail(ResultCode.SYSTEM_ERROR);
    }

  }


}
